package com.supermap.guangzhou.weifang.utils;

import android.content.Context;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import com.supermap.guangzhou.weifang.R;

/**
 * Created by XueQing Wang on 2018/5/11.
 */

public class ToastUtil {
    private static Toast toast;
    private static LayoutInflater layoutInflater;
    private static ImageView lv;
    private static TextView tv_msg;

    public static void makeText(Context context, String msg) {
        toast = Toast.makeText(context, msg, Toast.LENGTH_SHORT);
        Toast toast = new Toast(context);
        layoutInflater = LayoutInflater.from(context);
        View view = layoutInflater.inflate(R.layout.toast, null);
        lv = view.findViewById(R.id.iv_notice);
        tv_msg = view.findViewById(R.id.tv_msg);
        tv_msg.setText(msg);
        toast.setDuration(Toast.LENGTH_SHORT);
        toast.setGravity(Gravity.CENTER, 0, 0);
        toast.setView(view);
        toast.show();
    }
}
